package com.linjiahao.nettyOne;

import com.linjiahao.nettyOne.server.NettyServer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.ComponentScan;

@ComponentScan(basePackages = {"com.linjiahao"})
@SpringBootApplication
@EnableFeignClients
@Slf4j
public class NettyOneChatApplication implements CommandLineRunner {

    @Autowired
    NettyServer nettyServer;

    public static void main(String[] args) {
        SpringApplication.run(com.linjiahao.nettyOne.NettyOneChatApplication.class, args);
    }


    @Override
    public void run(String... args) {
        try {
            nettyServer.start();
            log.info("netty服务启动成功");
        } catch (Exception e) {
            log.error("netty服务启动失败：{}", e);
        }

    }
}
